import { message } from "antd";
import axios,{AxiosResponse} from "axios";
import {BaseResponse} from "../types";

axios.interceptors.response.use((response:AxiosResponse<BaseResponse>) => {
    if(response.data.code!==1000) {
        message.error(response.data.message);
        throw new Error(response.data.message);
    }

    return response.data.data
})

export default axios;